package com.xian.pojo;

import com.xian.utils.DateUtils;

import java.util.Date;
import java.util.List;

public class Orders {
    private String id;  // 主键uuID
    private String orderNum; // 订单ID
    private Date orderTime; // 下单时间
    private String orderTimeStr; //
    private int peopleCount;  // 出行人数
    private String orderDesc;  // 订单描述
    private Integer payType;  // 支付方式 0 支付宝 1 微信 2 其他
    private String payTypeStr;  //
    private Integer orderStatus;  //   订单状态 0 未支付 1 已支付
    private String orderStatusStr;
    private Product product;  // 产品，外键

    private Member member;  // 会员（联系人），外键

    private List<Traveller> travellers;  // 旅客们

    @Override
    public String toString() {
        return "Orders{" +
                "id='" + id + '\'' +
                ", orderNum='" + orderNum + '\'' +
                ", orderTime=" + orderTime +
                ", orderTimeStr='" + orderTimeStr + '\'' +
                ", peopleCount=" + peopleCount +
                ", orderDesc='" + orderDesc + '\'' +
                ", payType=" + payType +
                ", payTypeStr='" + payTypeStr + '\'' +
                ", orderStatus=" + orderStatus +
                ", orderStatusStr='" + orderStatusStr + '\'' +
                ", product=" + product +
                ", member=" + member +
                ", travellers=" + travellers +
                '}';
    }

    public Orders() {
    }

    public Orders(String id, String orderNum, Date orderTime, String orderTimeStr, int peopleCount, String orderDesc, Integer payType, String payTypeStr, Integer orderStatus, String orderStatusStr, Product product, Member member, List<Traveller> travellers) {
        this.id = id;
        this.orderNum = orderNum;
        this.orderTime = orderTime;
        this.orderTimeStr = orderTimeStr;
        this.peopleCount = peopleCount;
        this.orderDesc = orderDesc;
        this.payType = payType;
        this.payTypeStr = payTypeStr;
        this.orderStatus = orderStatus;
        this.orderStatusStr = orderStatusStr;
        this.product = product;
        this.member = member;
        this.travellers = travellers;
    }

    public String getId() {
        System.out.println("------------------------");
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderTimeStr() {
        if (orderTime != null){
            orderTimeStr = DateUtils.date2String(orderTime);
        }
        return orderTimeStr;
    }

    public void setOrderTimeStr(String orderTimeStr) {
        this.orderTimeStr = orderTimeStr;
    }

    public int getPeopleCount() {
        return peopleCount;
    }

    public void setPeopleCount(int peopleCount) {
        this.peopleCount = peopleCount;
    }

    public String getOrderDesc() {
        return orderDesc;
    }

    public void setOrderDesc(String orderDesc) {
        this.orderDesc = orderDesc;
    }

    public Integer getPayType() {
        return payType;
    }

    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    public String getPayTypeStr() {
        System.out.println("=================");
        // 支付方式 0 支付宝 1 微信 2 其他
        if (payType != null){
            if (payType == 0){
                payTypeStr = "支付宝";
            } else if (payType == 1){
                payTypeStr = "微信";
            } else {
                payTypeStr = "其他";
            }
        }
        return payTypeStr;
    }

    public void setPayTypeStr(String payTypeStr) {
        this.payTypeStr = payTypeStr;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public String getOrderStatusStr() {
        System.out.println("=================");
        //   订单状态 0 未支付 1 已支付
        if (orderStatus != null){
            if (orderStatus == 0){
                orderStatusStr = "未支付";
            } else {
                orderStatusStr = "已支付";
            }
        }
        return orderStatusStr;
    }

    public void setOrderStatusStr(String orderStatusStr) {
        this.orderStatusStr = orderStatusStr;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public List<Traveller> getTravellers() {
        return travellers;
    }

    public void setTravellers(List<Traveller> travellers) {
        this.travellers = travellers;
    }
}
